<?php

namespace app\api\validate;


use think\Validate;

class AreaValidate extends Validate
{
    /**
     * 验证规则
     */
    protected $rule = [
        'page' => 'require|integer|>:0',
        'limit' => 'require|integer|>:0',
        'level' => 'in:1,2,3',
        'keyword' => 'max:50',
    ];

    /**
     * 提示消息
     */
    protected $message = [
        'page.require' => 'page不能为空',
        'page.integer' => 'page必须为整数',
        'page.>0' => 'page必须大于0',
        'limit.require' => 'limit不能为空',
        'limit.integer' => 'limit必须为整数',
        'limit.>0' => 'limit必须大于0',
        'level.in' => '层级格式不正确',
        'keyword.max' => '关键词最多不能超过100个字符',
    ];

    /**
     * 字段描述
     */
    protected $field = [
    ];

    /**
     * 验证场景
     */
    protected $scene = [
        // 列表
        'list'  => [
            'page' => ['require', 'integer', '>:0'],
            'limit' => ['require', 'integer', '>:0'],
            'level' => ['in:1,2,3'],
            'keyword' => ['max:100'],
        ],
    ];

}